<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ include file="/commons/taglibs.jsp" %>
<%@ include file="/commons/nocache.jspf" %>
<%@ taglib uri="/FCKeditor" prefix="FCK"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />

<title>下载管理</title>
<link href="${ctx }/css/admin/css.css" rel="stylesheet" type="text/css" />
<script src="${ctx}/scripts/datepicker/WdatePicker.js"></script>
<style type="text/css">
<!--
body,td,th {
	font-size: 12px;
	color: #000000;
}
body {
	background-color: #F3F8FC;
	margin-left: 0px;
	margin-top: 0px;
	margin-right: 0px;
	margin-bottom: 0px;
}
a {
	font-family: 宋体;
	font-size: 12px;
	color: #000000;
}
a:visited {
	color: #000000;
}
a:hover {
	color: #FF3300;
}
a:active {
	color: #000000;
}
-->
#newPreview
{
    filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(sizingMethod=scale);
}
-->
</style>
<script type="text/javascript" src="${ctx }/fckeditor/fckeditor.js"></script>
<script type="text/javascript" src="${ctx}/scripts/commons/annext.js"></script>
<script type="text/javascript" src="${ctx}/scripts/commons/jquery-1.2.3.pack.js"></script>
<script type="text/javascript" src="${ctx}/scripts/commons/jquery.MultiFile.js"></script>
<script type="text/javascript">

		function PreviewImg(imgFile){
		    //新的预览代码，支持 IE6、IE7。
		    var newPreview = document.getElementById("newPreview");
		    newPreview.filters.item("DXImageTransform.Microsoft.AlphaImageLoader").src = imgFile.value;
		    if(imgFile.value)
	  			newPreview.style.height = "71px";
			if(newPreview.innerHTML.length > 0 ){
				newPreview.innerHTML = "";
			}				
		}	
		function showSub(){
					var obj=document.getElementById("shows");
					obj.style.display='block';
				}
				function hideSub(){
					var obj=document.getElementById("shows");
					obj.style.display='none';
				}
		function addDownload(){
				var funcId = document.getElementById("download.funcId").value ;
				var name = document.getElementById("download.downHead").value;
				var nameEn = document.getElementById("download.downHeadEn").value;
				var file = document.getElementById("fileDown").value;

			if(funcId.length == 0 || Trim(funcId)==''){
			   document.getElementById("errFuncId").innerHTML = "<font color='red'>功能分类不能为空</font>";
			   return false;
			}
			if(funcId.length>32 ){
			   document.getElementById("errFuncId").innerHTML = "<font color='red'>功能分类不能超过32字符</font>";
			   return false;
			}
			if(name.length == 0 || Trim(name)==''){
			   document.getElementById("errName").innerHTML = "<font color='red'>文件标题不能为空</font>";
			   return false;
			}
			if(name.length>100 ){
			   document.getElementById("errName").innerHTML = "<font color='red'>文件标题不能超过100字符</font>";
			   return false;
			}
			if(nameEn.length>100 ){
			   document.getElementById("errNameEn").innerHTML = "<font color='red'>文件标题（英）不能超过100字符</font>";
			   return false;
			}
			if(file.length == 0 || Trim(name)==''){
			   document.getElementById("errFile").innerHTML = "<font color='red'>不能上传空文件</font>";
			   return false;
			}
			 document.forms[0].submit();
				 
			}
		    //去空格函数 
		function LTrim(str) 
		{ 
		var i; 
		for(i=0;i<str.length;i++) 
		{ 
			if(str.charAt(i)!=" "&&str.charAt(i)!=" ")break; 
		} 
			str=str.substring(i,str.length); 
			return str; 
		} 
		function RTrim(str) 
		{ 
		var i; 
			for(i=str.length-1;i>=0;i--) 
			{ 
			 if(str.charAt(i)!=" "&&str.charAt(i)!=" ")break; 
			} 
		str=str.substring(0,i+1); 
		return str; 
		} 
		function Trim(str) 
		{ 
			return LTrim(RTrim(str)); 
		} 		
		function showFun(){
		    var str=window.location;
			var item=window.showModalDialog("${ctx}/user/user_showFun.action?funcstr="+ str,window,"scroll:no;dialogHeight=500px;dialogWidth=420px;");
		var names ="";
        var ids ="";
	   if(item != null){
	    
	          names += item[0][0];
	          ids += item[0][1];
	      }
      	document.getElementById("funcid").value = ids;
    	document.getElementById("funcname").value = names;
		}
			
</script>

</head>
<link href="${ctx}/css/main/base.css" rel="stylesheet" type="text/css"/>
<link href="${ctx}/css/main/main.css" rel="stylesheet" type="text/css"/>
<body>
<div id="main">
	<div class="zdsz" id="select1">

<div class="tab"><a href="${ctx}/download/download!index.action"><h3 class="sel" >添加下载</h3></a><a href="${ctx}/download/download!listDownload.action"><h3>下载列表</h3></a></div>
		<div class="zd_gut">
		<ul class="block">
		<li>

<form name="form1" action="${ctx}/download/download!saveDownload.action" method="post"  enctype="multipart/form-data">
<table width="100%" border="0" cellpadding="0" cellspacing="0" background="${ctx }/images/maintopbg.gif">
  <tr>
    <td align="left"><img src="${ctx }/images/maintop.gif" width="7" height="12" /></td>
  </tr>
</table>
<table width="100%" border="0" cellspacing="0" cellpadding="0">

</table>
<table width="95%" border="0" align="center" cellpadding="0" cellspacing="1" bgcolor="#CCCCCC">

   <tr>
    <td   height="30" align="right" bgcolor="#DFEAF3">功能分类：</td>
     <td height="30" align="left" bgcolor="#FFFFFF" class="tblz5">
    	<input type="hidden" id="funcid" name="download.funcId"/>
    	<input type="input" id="funcname" readonly name="funcnames" onclick="showFun();"/><div id="errFuncId"></div>
    </td>
    <td height="25" align="right" bgcolor="#DFEAF3">文件显示状态：</td>
    <td height="25" align="left" bgcolor="#FFFFFF" class="tblz5">
    <input type="radio" id="download.downFlag" name="download.downFlag" value="0" checked />中文
    <input type="radio" id="download.downFlag" name="download.downFlag" value="1" />英文
    <input type="radio" id="download.downFlag" name="download.downFlag" value="2" />中英文
    </td>
  </tr>
  
  <tr>
    <td height="30" align="right" bgcolor="#DFEAF3">文件标题：</td>
    <td height="30" align="left" bgcolor="#FFFFFF" class="tblz5"><input id="fileHead" name="download.downHead" type="text" class="input01" maxlength="200"/><div id="errName"></div></td>
    <td height="30" align="right" bgcolor="#DFEAF3">文件标题(英)：</td>
    <td height="30" align="left" bgcolor="#FFFFFF" class="tblz5"><input id="fileHeadEn" name="download.downHeadEn" type="text" class="input01" maxlength="200"/><div id="errNameEn"></div></td>
  </tr>

  <tr>
    <td height="25" align="right" bgcolor="#DFEAF3">文件上传：</td>
    <td height="25" colspan="3"  align="left" bgcolor="#FFFFFF" class="tblz5">
    <input id="file" type="file" name="fileDown"  class="input01" onchange="javascript:PreviewImg(this);"/><div id="errFile"></div>
    </td>
   </tr>
  

</table>
<table height="50" border="0" cellpadding="0" cellspacing="0">
  <tr>
    <td width="150" align="right"><input type="button" onclick="addDownload();" value="提交" class="btn"/></td>
    <td width="100" align="right"><input type="reset" value="重置" class="btn"/></td>
  </tr>
</table>
</from>
</li>
		</ul>
		</div>
	</div>
</div>
</body>
</html>

